package net.example.lesson3.proxy;

import net.example.lesson3.annotation.TestAnnotaion;
import org.springframework.util.StringUtils;

/**
 * 将要被代理的类
 *
 * @author 肖红亮
 * @date 2018/9/6
 * @since JDK1.7
 */
@TestAnnotaion(type = "Class测试的注解内容")
public class Student implements Subject {

    //学生姓名
    private String name;

    @TestAnnotaion(type = "Field测试的注解内容")
    private String account;

    public String sex;

    public Student() {
    }

    public Student(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    @TestAnnotaion(type = "Method测试的注解内容")
    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }
    /**
     * 上交班费
     */
    @Override
    public void giveMoney() {
        System.out.println(name + "上交班费50元");
    }
    /**
     * 兴趣爱好
     */
    @Override
    public void registerLike(String like) {
        System.out.println(String.format("%s登记了兴趣爱好为 %s", name, like));
        if(!StringUtils.isEmpty(account)) {
            System.out.println(String.format("account: %s", account));
        }
        if(!StringUtils.isEmpty(sex)) {
            System.out.println(String.format("sex: %s", sex));
        }
    }

    private void testPrivate(String str) {
        System.out.println("方法内部输出---私有方法" + str);
    }
}
